/**
* @file 单轴参数设置
* @brief
*
*
*
* @author
* @date
* @see
* @note
*
*
*
*/
#include "axishandshakewidget.h"

QAxisHandShakeWidget::QAxisHandShakeWidget(int i32AxisNo,QString sAxisName,QWidget *parent) : QWidget(parent)
{
    _i32AxisNo = i32AxisNo;
    _sAxisName = sAxisName;

    InitUI();

    connect(_pSetParamButton,&QPushButton::clicked,this,&QAxisHandShakeWidget::onSetParamButtonClick);

}

QAxisHandShakeWidget::~QAxisHandShakeWidget()
{

}
/**
* @brief 初始化界面
* @note
*
*/
void QAxisHandShakeWidget::InitUI()
{
    this->setStyleSheet("QLabel{color:rgb(200,200,200);}");

    _pValueEdit = new QLineEdit("0.0",this);
    _pValueEdit->setMinimumHeight(25);
    QUIQss::setTxtQss(_pValueEdit, "#DCE4EC", "#1ABC9C");

    _pSetParamButton = new QPushButton("握手",this);
    QUIQss::setBtnQss(_pSetParamButton,"#1ABC9C", "#E6F8F5", "#2EE1C1", "#FFFFFF", "#16A086", "#A7EEE6");

    int nRow = 0;

    QGridLayout* playout = new QGridLayout(this);

    playout->addWidget(new QLabel("模式:"),nRow,0,1,1);
    playout->addWidget(new QLabel("位置给定"),nRow,1,1,2);
    nRow++;
    playout->addWidget(new QLabel("目标转角(°):"),nRow,0,1,1);
    playout->addWidget(_pValueEdit,nRow,1,1,1);
    playout->addWidget(_pSetParamButton,nRow,2,1,1);

}

/**
* @brief 设置参数
* @note
*
*/
void QAxisHandShakeWidget::onSetParamButtonClick()
{
    float lfValue = _pValueEdit->text().toFloat();

    int i32value = lfValue * (16777216/360);


    emit signal_sethandshake(_i32AxisNo,i32value,3);
}

